<template>
	<view class="">
		<u-checkbox-group v-for="(item,index) in yylist" :key="index">
			<view class="bj">
				<view class="quan">
					<view class="qian">
						<text class="danwi">￥</text>
						<text>{{item.money}}</text>
					</view>
					<view class="rightbox">
						<view class="qpq">
							{{item.name}}
						</view>
						<view class="ky">
							满{{item.full_moeny}}元可用
						</view>
						<view class="time">
							有效期至：{{item.end_time}}
						</view>
					</view>
				</view>
				<view class="checkbox">
					<u-checkbox @change="checkboxChange(index)" max="1" active-color="#ee3647" shape="circle" size="45"
						icon-size="30" v-model="item.checked">
					</u-checkbox>
				</view>
			</view>
		</u-checkbox-group>
		<view class="hrsss">
			
		</view>
		<view class="qr" @click="qeren">
			确认
		</view>
	</view>
</template>

<script>
	import {
		getusercoupons
	} from "../../api/api/index.js"
	export default {
		data() {
			return {
				list: [{
					checked: false,
				}],
				// limit: 20,
				// page: 0,
				// flag: false,
				yylist: [],
				// lists:[]
			}
		},
		methods: {
			checkboxChange(v) {
				let x=this.yylist[v]
				uni.setStorageSync("xzcoupons",{coupons_id:x.id,money:x.money})
			},
			// 返回上一层
			qeren(){
				uni.navigateBack({
					delta:1
				})
			},
			// public(flag) {
			// 	if (flag) {
			// 		this.page = 0;
			// 		this.yylist = [];
			// 		this.flag = false;
			// 	}
			// 	this.page++;
			// 	let pass = {
			// 		page: this.page,
			// 		limit: this.limit,
			// 		type: 1
			// 	};
			// 	getusercoupons().then(res => {
			// 		if (res.data.length < this.limit) {
			// 			this.flag = true;
			// 		}
			// 		let list = res.data.map(v => {
			// 			v.checked = false
			// 			return v
			// 		})
			// 		this.yylist = this.yylist.concat(list);
			// 	})
			// }
		},
		onLoad() {
			// this.public()
			this.yylist=uni.getStorageSync("coupons").map(v=>{
				v.checked=false
				return v
			})
		}
	}
</script>

<style scoped lang="scss">
	.bj {
		width: 710rpx;
		height: 185rpx;
		background-color: #fab210;
		border-radius: 20rpx;
		margin-left: 20rpx;
		margin-top: 38rpx;
		display: flex;
		align-items: center;
		padding-left: 8rpx;
		box-sizing: border-box;
	}

	.quan {
		background: url(../../static/image/youhuiquan.png);
		background-size: 565rpx 159rpx;
		width: 565rpx;
		height: 159rpx;
		position: relative;

		.qian {
			display: block;
			position: absolute;
			left: 34rpx;
			top: 27rpx;

			text {
				font-family: Bebas;
				font-size: 80rpx;
				color: #ee3647;
			}

			.danwi {
				font-size: 43rpx;
			}
		}

		.rightbox {
			position: absolute;
			right: 67rpx;
			display: block;
			top: 27rpx;

			.qpq {
				font-family: MicrosoftYaHei;
				font-size: 24rpx;
				color: #ee3647;
			}

			.ky {
				width: 194rpx;
				height: 36rpx;
				background-color: #ee3647;
				border-radius: 10rpx;
				line-height: 36rpx;
				font-family: MicrosoftYaHei;
				font-size: 19rpx;
				color: #ffffff;
				padding-left: 10rpx;
				box-sizing: border-box;
				margin-top: 10rpx;
			}

			.time {
				font-family: MicrosoftYaHei;
				font-size: 18rpx;
				margin-top: 10rpx;
				color: #999999;
			}
		}
	}

	.gq {
		width: 123rpx;
		height: 93rpx;
	}


	.bjs {
		width: 710rpx;
		height: 185rpx;
		background-color: #fab210;
		border-radius: 20rpx;
		margin-left: 20rpx;
		margin-top: 38rpx;
		display: flex;
		align-items: center;
		filter: grayscale(100%);
		-webkit-filter: grayscale(100%);
		-moz-filter: grayscale(100%);
		-ms-filter: grayscale(100%);
		-o-filter: grayscale(100%);
		filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
		-webkit-filter: grayscale(1);
	}

	.checkbox {
		margin-left: 51rpx;
	}
	.hrsss{
		height: 100rpx;
	}
	.qr{
		width: 100%;
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		font-size: 30rpx;
		font-family: Microsoft YaHei;
		color: #FFFFFF;
		background: #EE3647;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
	}
</style>
